/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.ipccenter.toster.jpa;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Collection;
import javax.persistence.*;

/**
 *
 * @author 7
 */
@Entity
@Table(name = "STUDENTS")

public class JPAStudent implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Column(name = "STUDENT_ID")
    private BigInteger studentId;
   
    @Column(name = "STUDENT_NAME")
    private String studentName;
    @OneToMany(mappedBy = "studentId")
    private Collection<JPASession> sessions;

    public JPAStudent() {
    }

    public JPAStudent(BigInteger studentId) {
        this.studentId = studentId;
    }

    public BigInteger getStudentId() {
        return studentId;
    }

    public void setStudentId(BigInteger studentId) {
        this.studentId = studentId;
    }

    public String getStudentName() {
        return studentName;
    }

    public void setStudentName(String studentName) {
        this.studentName = studentName;
    }

    public Collection<JPASession> getSessionsCollection() {
        return sessions;
    }

    public void setSessionsCollection(Collection<JPASession> sessions) {
        this.sessions = sessions;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (studentId != null ? studentId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof JPAStudent)) {
            return false;
        }
        JPAStudent other = (JPAStudent) object;
        if ((this.studentId == null && other.studentId != null) || (this.studentId != null && !this.studentId.equals(other.studentId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.ipccenter.toster.jpa.Students[ studentId=" + studentId + " ]";
    }
    
}
